<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="IndexUsuario.xhtml">
	
	
	<ui:define name="conteudo">
		<f:loadBundle basename="br.ucb.jogo.recursos.messages" var="msg" />
		<h:form id="form">
		<br/><br/><br/>
			<center>  
			    <p:dataTable emptyMessage="#{msg.NENHUM_ITEM}" var="item" value="#{itensManagedBean.itens}" rowKey="#{item.nome}" paginator="true" rows="10" filteredValue="#{itensManagedBean.filtroItens}" id="TableItens">  
			  
			        <f:facet name="header">  
			        	<h:outputText value="#{msg.LISTAR_ITEM}"/>  
			        </f:facet>  
					
			        <p:column headerText="#{msg.NOME}" sortBy="#{item.nome}" filterBy="#{item.nome}" id="nome" width="400">  
			            <h:outputText value="#{item.nome}"/>
			        </p:column>  
			  		
			  		<p:column headerText="#{msg.PRECO}" sortBy="#{item.preco}" id="preco" width="100">  
			            <h:outputText value="#{item.preco}"/>
			        </p:column>
			        
			        <p:column headerText="#{msg.LEVEL_NECESSARIO}" sortBy="#{item.levelNecessario}" id="levelNecessario" width="200">  
			            <h:outputText value="#{item.levelNecessario}"/>
			        </p:column>
			        
			        <p:column headerText="#{msg.FORCA}" sortBy="#{item.forca}" id="forca" width="100">  
			            <h:outputText value="#{item.forca}"/>
			        </p:column>
			        
			        <p:column headerText="#{msg.AGILIDADE}" sortBy="#{item.agilidade}" id="agilidade" width="100">  
			            <h:outputText value="#{item.agilidade}"/>
			        </p:column>
			        
			        <p:column headerText="#{msg.DEFESA}" sortBy="#{item.defesa}" id="defesa" width="100">  
			            <h:outputText value="#{item.defesa}"/>
			        </p:column>
			        
			        <p:column headerText="#{msg.MANA}" sortBy="#{item.mana}" id="mana" width="100">  
			            <h:outputText value="#{item.mana}"/>
			        </p:column>
			  		
			  	<p:column headerText="#{msg.COMPRAR}" id="compra">
					<p:commandButton action="#{personagemManagedBean.compraItem}" label="Comprar" value="comprar" immediate="true">
						<f:setPropertyActionListener target="#{personagemManagedBean.itensSelect}"	value="#{item}" />
					</p:commandButton>
				</p:column>
			        			        
			    </p:dataTable>  
			</center>  
		</h:form>   	
		
	</ui:define>

	
</ui:composition>
</html>
